<%@ page language="java" import="java.util.*,cn.java.common.*"
		 contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="cn.java.perdure.ProgramaTable"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
	<base target="_self">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="css/common.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="js/dateJs.js"></script>
	<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
	<script type="text/javascript" src="js/Calendar.js"></script>
	<script type="text/javascript" src="ondblcome/js/dtree.js"></script>
	<script language="javascript">
		document.write("<DIV id='aa' style=position:absolute><DIV id='cc' onmousedown=divMove('aa') style='BORDER-RIGHT: #6073EC 1px solid; PADDING-RIGHT: 12px; BORDER-TOP: #6073EC 1px solid; PADDING-LEFT: 12px; Z-INDEX: 1001; BACKGROUND: #ffffff; FILTER: Alpha(opacity=85); LEFT: 505px; VISIBILITY: hidden; PADDING-BOTTOM: 12px; BORDER-LEFT: #6073EC 1px solid; WIDTH: 200px; LINE-HEIGHT: 22px; PADDING-TOP: 12px; BORDER-BOTTOM: #6073EC 1px solid; POSITION: absolute; cursor: move;TOP: 419px; HEIGHT: 90px'></DIV>")
		document.write("<DIV id='iframediv' style='BORDER-RIGHT: #6073EC 0px solid; PADDING-RIGHT: 0px; BORDER-TOP: #6073EC 0px solid; PADDING-LEFT: 0px; Z-INDEX: 1000; BACKGROUND: #ffffff; FILTER: Alpha(opacity=85); LEFT: 505px; VISIBILITY: hidden; PADDING-BOTTOM: 0px; BORDER-LEFT: #6073EC 0px solid; WIDTH: 200px; PADDING-TOP: 0px; BORDER-BOTTOM: #6073EC 0px solid; POSITION: absolute; TOP: 419px; HEIGHT: 175px'></DIV></DIV>")
		document.write("<style>td {font-family: Arial, Helvetica, sans-serif;font-size: 12px;white-space: nowrap;}table{border-collapse:collapse} .sel{font-family: Webdings;font-size: 9pt;font-weight: bold;color: #243F65;cursor:hand;text-decoration: none; background-color:DEDEEF}</style>");
	</script>
	<style type="text/css">
		.color {
			background-color: red;
		}

		table {
			width: 200px;
			border: 1px solid green;
			table-layout: fixed;
		}

		td {
			width: 50%;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.container {
			width: 980px;
			margin: 0 auto;
		}

		.top {
			background-color: #80ff80;
		}

		.table1 {
			margin-top: 50px;
			background-color: #f0f0f0;
			height: 100px;
		}

		.table1 thead {
			height: 50px;
		}

		.table1 tr td, .table1 tr th {
			padding: 20px;
			text-align: center;
		}
	</style>
	<script type="text/javascript">
		<%

            List<ProgramaTable> collist=(List<ProgramaTable>)request.getAttribute("programaTableList");
            String ename="", ename_visible="none";
            String eno="" ,eno_visible="none";
            String etye="",etye_visible="none";
            String enumber="", enumber_visible="none";
            String eremark="", eremark_visible="none";
            String bzremark="", bzremark_visible="none";
            String rname="", rname_visible="none";
            String status="", status_visible="none";
            String eusedep="", eusedep_visible="none";
            String enamel="", enamel_visible="none";
            String reportednum="", reportednum_visible="none";
            String reportedunit="", reportedunit_visible="none";
            String construcunit="", construcunit_visible="none";
            String euseunit="", euseunit_visible="none";
            String gdhtno="", gdhtno_visible="none";
            String eusedate="", eusedate_visible="none";
            String edate="", edate_visible="none";
            String eddno="", eddno_visible="none";
            String efactory="", efactory_visible="none";
            String efdate="", efdate_visible="none";
            String esmyear="", esmyear_visible="none";
            String efno="", efno_visible="none";
            String ewbzq="", ewbzq_visible="none";
            String especi="", especi_visible="none";
            String etype="", etype_visible="none";
            String filename="", filename_visible="none";
            String edef1="", edef1_visible="none";

            int len =collist.size();
            for(int i =0;i<len;i++){
                ProgramaTable programaTable =collist.get(i);

                if(programaTable.getPrograma_num().equals("ename")){
                    ename = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       ename_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("eno")){
                    eno = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       eno_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("etye")){
                    etye = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       etye_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("enumber")){
                    enumber = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       enumber_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("eremark")){
                    eremark = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       eremark_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("bzremark")){
                    bzremark = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       bzremark_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("rname")){
                    rname = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       rname_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("status")){
                    status = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                      status_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("eusedep")){
                    eusedep = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       eusedep_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("employee.ename")){
                    enamel = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       enamel_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("reportednum")){
                    reportednum = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       reportednum_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("reportedunit")){
                    reportedunit = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       reportedunit_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("construcunit")){
                    construcunit = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       construcunit_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("euseunit")){
                    euseunit = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       euseunit_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("gdhtno")){
                    gdhtno = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       gdhtno_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("eusedate")){
                    eusedate = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       eusedate_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("edate")){
                    edate = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       edate_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("eddno")){
                    eddno = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       eddno_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("efactory")){
                    efactory = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       efactory_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("efdate")){
                    efdate = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       efdate_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("esmyear")){
                    esmyear = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       esmyear_visible = "";
                   }
                }if(programaTable.getPrograma_num().equals("efno")){
                    efno = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                      efno_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("ewbzq")){
                    ewbzq = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       ewbzq_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("especi")){
                    especi = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       especi_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("etype")){
                    etype = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       etype_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("filename")){
                    filename = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       filename_visible = "";
                   }
                }
                if(programaTable.getPrograma_num().equals("edef1")){
                    edef1 = programaTable.getPrograma_name();
                   if(Boolean.valueOf(programaTable.getPrograma_visible()).booleanValue()){
                       edef1_visible = "";
                   }
                }

            }

        %>
		if("<%= ename_visible %>" == "none" && "<%= eno_visible %>" == "none" && "<%= etye_visible %>" =="none"  ){
			document.getElementById("xiaoJi").colspan = 2;
		}
		if("<%= ename_visible %>" == "none" && "<%= eno_visible %>" == "none"  ){
			document.getElementById("xiaoJi").colspan = 3;
		}
		if("<%= ename_visible %>" == "none"  ){
			document.getElementById("xiaoJi").colspan = 4;
		}

	</script>

</head>
<body class="body" onload="countF();">
<div id="divmain" class="divmains55" style="height: 95%">
	<table id="scroll_bar" class="table table1 container" border="1" cellspacing="0"
		   cellpadding="0">
		<tr id="bar_head" align="center" style="background: '#eee';" class="trHead">
			<th class="th">&nbsp;</th>
			<th class="th"><input title="全选/不选->所有记录" id="checkall"
								  name="checkall" type="checkbox" onclick="checkBoxAll('ids');">&nbsp;
			</th>
			<th class="th" style="display: <%= etype_visible %>"><%=etype %></th>
			<th class="th" style="display: <%= ename_visible %>"><%=ename %></th>
			<th class="th" style="display: <%= eno_visible %>"><%=eno %></th>
			<th class="th">设备大类</th>
			<th class="th" style="display: <%= etye_visible %>"><%=etye %></th>
			<th class="th" style="display: <%= enumber_visible %>"><%=enumber %></th>
			<th class="th" style="display: <%= eremark_visible %>"><%=eremark %></th>


			<th class="th" style="display: <%= rname_visible %>"><%=rname %></th>
			<th class="th" style="display: <%=status_visible %>"><%=status %></th>
			<th class="th">预计报废时间</th>
			<th class="th" style="display: <%= eusedep_visible %>"><%=eusedep %></th>
			<th class="th" style="display: <%= enamel_visible %>">保修联系人</th>

			<th class="th" style="display: <%= reportednum_visible %>"><%=reportednum %></th>
			<th class="th" style="display: <%= reportedunit_visible %>"><%=reportedunit %></th>
			<th class="th" style="display: <%= construcunit_visible %>"><%=construcunit %></th>
			<th class="th" style="display: <%= euseunit_visible %>"><%=euseunit %></th>
			<th class="th" style="display: <%= gdhtno_visible %>"><%=gdhtno %></th>

			<th class="th" style="display: <%= eusedate_visible %>"><%=eusedate %></th>
			<th class="th" style="display: <%= edate_visible %>"><%=edate %></th>
			<th class="th" style="display: <%= eddno_visible %>"><%=eddno %></th>
			<th class="th" style="display: <%= efactory_visible %>"><%=efactory %></th>
			<th class="th" style="display: <%= efdate_visible %>"><%=efdate %></th>
			<th class="th" style="display: <%= esmyear_visible %>"><%=esmyear %></th>
			<th class="th" style="display: <%= efno_visible %>"><%=efno %></th>
			<th class="th" style="display: <%= ewbzq_visible %>"><%=ewbzq %></th>
			<th class="th" style="display: <%= especi_visible %>"><%=especi %></th>

			<th class="th" style="display: <%= filename_visible %>"><%=filename %></th>
			<th class="th" style="display: <%= edef1_visible %>"><%=edef1 %></th>
			<th class="th" style="display: <%= bzremark_visible %>"><%=bzremark %></th>
		</tr>
		<logic:present name="elist" scope="request">
			<logic:iterate id="eng" name="elist"
						   type="cn.java.perdure.Engineering" indexId="hh">
				<bean:define id="newId" name="eng" property="id"></bean:define>
				<logic:equal name="eng" property="states" value="N">
					<tr align="left" id="tre${hh+1}" class=''
					onclick="onclickEF(this,'${eng.id}','${eng.eno}');"
					ondblclick="ondblclickEF(${eng.id});"
					style="cursor: default; background-color: red">
				</logic:equal>
				<logic:equal name="eng" property="states" value="Y">
					<tr align="left" id="tre${hh+1}" class=''
					onclick="onclickEF(this,'${eng.id}','${eng.eno}');"
					ondblclick="ondblclickEF(${eng.id});" style="cursor: default;">
				</logic:equal>
				<logic:equal name="eng" property="states" value="O">
					<tr align="left" id="tre${hh+1}" class=''
					onclick="onclickEF(this,'${eng.id}','${eng.eno}');"
					ondblclick="ondblclickEF(${eng.id});"
					style="cursor: default; background-color: yellow">
				</logic:equal>
				<td>${hh+1}</td>
				<td><input value="${eng.id}" name="ids" type="checkbox"
						   onclick="checkItem('checkall');"> <input
						value="${eng.eno}" name="eno" type="hidden"
						onclick="checkItem('checkall');"> <input
						value="${eng.ename}" name="ename" type="hidden"
						onclick="checkItem('checkall');"></td>
				<td style="display: <%=etype_visible %>">${eng.etype}</td>
				<td style="display: <%=ename_visible %>">${eng.ename}</td>
				<td style="display: <%=eno_visible %>">${eng.eno}</td>
				<td>${eng.equipmentCategory.name}</td>
				<td style="display: <%=etye_visible %>">${eng.etye}</td>
				<td style="display: <%=enumber_visible %>" id="sumNum"
					visible="<%=enumber_visible %>">${eng.enumber}</td>
				<td style="display: <%=eremark_visible %>">${eng.eremark}</td>


				<td style="display: <%=rname_visible %>">${eng.regional.rname}</td>
				<td style="display: <%=status_visible %>"><logic:equal
						name="eng" property="status" value="已报废">
					<a style="color: red;" id="tda${newId}">${eng.status}</a>
				</logic:equal> <logic:notEqual name="eng" property="status" value="已报废">
					<a style="color: green;" id="tda${newId}">${eng.status}</a>
				</logic:notEqual></td>
				<td id="date1" name="${eng.id}">${eng.expected_retirement_date}</td>
				<td style="display: <%=eusedep_visible %>">${eng.eusedep}</td>
				<td style="display: <%=enamel_visible %>">${eng.ebxtel}</td>


				<td style="display: <%=reportednum_visible %>">${eng.reportednum}</td>
				<td style="display: <%=reportedunit_visible %>">${eng.reportedunit}</td>
				<td style="display: <%=construcunit_visible %>">${eng.construcunit}</td>
				<td style="display: <%=euseunit_visible %>">${eng.euseunit}</td>
				<td style="display: <%=gdhtno_visible %>">${eng.gdhtno}</td>

				<td style="display: <%=eusedate_visible %>">${eng.eusedate}</td>
				<td style="display: <%=edate_visible %>">${eng.edate}</td>
				<td style="display: <%=eddno_visible %>">${eng.eddno}</td>
				<td style="display: <%=efactory_visible %>">${eng.efactory}</td>
				<td style="display: <%=efdate_visible %>">${eng.efdate}</td>
				<td style="display: <%=esmyear_visible %>">${eng.esmyear}</td>
				<td style="display: <%=efno_visible %>">${eng.efno}</td>
				<td style="display: <%=ewbzq_visible %>">${eng.ewbzq}</td>
				<td style="display: <%=especi_visible %>">${eng.especi}</td>

				<td style="display: <%=filename_visible %>" align="left"><c:forEach
						items="${flist}" var="file">
					<c:if test="${file.engineering.id==eng.id}">
						<img src="images/icon/icon_saveattach.gif" title="附件">
						<a href="javascript:void(0)"
						   style="width: 60px; background-color: #ffffff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px;"
						   onclick="downAnnexFileF('${file.id}')"
						   title="单击下载  ${file.filename }" style="cursor: pointer;">${file.filename }</a>
						<br>
					</c:if>
				</c:forEach></td>
				<td style="display: <%=edef1_visible %>"><logic:equal
						name="eng" property="edef1" value="无">
					<a style="color: red" id="tda${newId}">${eng.edef1 }</a>
				</logic:equal> <logic:equal name="eng" property="edef1" value="有">
					<a style="color: blue" id="tda${newId}">${eng.edef1}</a>
				</logic:equal></td>
				<td style="display: <%=bzremark_visible %>">${eng.bzremark}</td>
				</tr>
			</logic:iterate>
			<tr>


				<td colspan="5" align="center" id="xiaoJi">小计</td>
				<td id="lastcount" align="center"
					style="display: <%=enumber_visible %>">&nbsp;</td>
				<td colspan="25"></td>
			</tr>
		</logic:present>
		<logic:notPresent name="elist">
			<tr>
				<td colspan="77">&nbsp;&nbsp;&nbsp;&nbsp; 没有数据! &nbsp;...</td>
			</tr>
		</logic:notPresent>
		<tr>
			<td colspan="77">&nbsp;</td>
		</tr>
	</table>
</div>
<div id="divmain2" class="divtops">
	<!-- 分页部分 -->
	<table class="table" border="1" cellspacing="0" cellpadding="2">
		<tr>
			<td colspan="10" align="right">
				当前共${page.thisCount}条&nbsp;&nbsp; 总${page.count}条&nbsp;
				共${page.pageCount}页
				当前为第${page.nowPage}页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <html:link
					href="javascript:selectpage('1')">首页</html:link>&nbsp; <html:link
					href="javascript:selectpage('${page.previousPage}')">上一页</html:link>&nbsp;
				<html:link href="javascript:selectpage('${page.nextPage}')">下一页</html:link>&nbsp;
				<html:link href="javascript:selectpage('${page.pageCount}')">尾页</html:link>&nbsp;
			</td>
		</tr>
	</table>
</div>
<script type="text/javascript">

	$(function(){
		var scroll_bar = $("#scroll_bar");//表格的id
		var bar_head = $("#bar_head");//表头
		var bar_height = bar_head.height();//表头高
		var sroll_header= scroll_bar.clone().attr('id','bb');//更改复制的表格id
		$(window).scroll(function(){
			var scroll_top = $('body').scrollTop() - scroll_bar.offset().top;//判断是否到达窗口顶部

			if (scroll_top > 0) {
				$('body').append('<div id="shelter"></div>');//复制的表格所在的容器
				$("#shelter").css({'height':bar_height,'position':'fixed','top':'0','overflow':'hidden','width':'980px','margin': '0 auto','left':'0','right':'0','border-bottom':'1px solid #c8c8c8'});
				sroll_header.appendTo('#shelter');
				$('#shelter table').removeClass(); //删除table原来有的默认class，防止margin,padding等值影响样式
				$('#shelter table').css({'width':'980px','background-color':'#f0f0f0','margin':'0 auto'});
				$('#shelter table tr th').css('height', bar_height);//此处可以自行发挥
				$('#shelter table tr td').css({'padding':'20px','text-align':'center'});

				$('#shelter').show();

			}else {
				$('#shelter').hide();
			}
		});

	});
</script>
</body>
</html>